﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraBars;

namespace Smart.HRM.Common.Common.Base
{
    public partial class XucToolbar : DevExpress.XtraEditors.XtraUserControl
    {
        public XucToolbar()
        {
            InitializeComponent();
        }


        private void InvokeAddClick()
        {
            ClickButtonEventHander addClick = this.AddClick;
            if (addClick != null)
            {
                addClick();
            }
        }

        private void InvokeCancelClick()
        {
            ClickButtonEventHander cancelClick = this.CancelClick;
            if (cancelClick != null)
            {
                cancelClick();
            }
        }

        private void InvokeCloseClick()
        {
            ClickButtonEventHander closeClick = this.CloseClick;
            if (closeClick != null)
            {
                closeClick();
            }
        }

        private void InvokeDeleteClick()
        {
            ClickButtonEventHander deleteClick = this.DeleteClick;
            if (deleteClick != null)
            {
                deleteClick();
            }
        }

        private void InvokeEditClick()
        {
            ClickButtonEventHander editClick = this.EditClick;
            if (editClick != null)
            {
                editClick();
            }
        }

        private void InvokeExportClick()
        {
            ClickButtonEventHander exportClick = this.ExportClick;
            if (exportClick != null)
            {
                exportClick();
            }
        }

        private void InvokeImportClick()
        {
            ClickButtonEventHander importClick = this.ImportClick;
            if (importClick != null)
            {
                importClick();
            }
        }

        private void InvokeInfoClick()
        {
            ClickButtonEventHander infoClick = this.InfoClick;
            if (infoClick != null)
            {
                infoClick();
            }
        }

        private void InvokePrintClick()
        {
            ClickButtonEventHander printClick = this.PrintClick;
            if (printClick != null)
            {
                printClick();
            }
        }

        private void InvokeRefreshClick()
        {
            ClickButtonEventHander refreshClick = this.RefreshClick;
            if (refreshClick != null)
            {
                refreshClick();
            }
        }

        private void InvokeSaveAndAddClick()
        {
            ClickButtonEventHander saveAndAddClick = this.SaveAndAddClick;
            if (saveAndAddClick != null)
            {
                saveAndAddClick();
            }
        }

        private void InvokeSaveAndCloseClick()
        {
            ClickButtonEventHander saveAndCloseClick = this.SaveAndCloseClick;
            if (saveAndCloseClick != null)
            {
                saveAndCloseClick();
            }
        }

        private void InvokeSaveClick()
        {
            ClickButtonEventHander saveClick = this.SaveClick;
            if (saveClick != null)
            {
                saveClick();
            }
        }

        [Category("Design"), Description("Button Add"), DefaultValue(false)]
        public BarItemVisibility ButtonAdd
        {
            get
            {
                return this.btnAdd.Visibility;
            }
            set
            {
                this.btnAdd.Visibility = value;
                base.Update();
            }
        }

        [Description("Button Cancel"), Category("Design"), DefaultValue(false)]
        public BarItemVisibility ButtonCancel
        {
            get
            {
                return this.btnCancel.Visibility;
            }
            set
            {
                this.btnCancel.Visibility = value;
                base.Update();
            }
        }

        [DefaultValue(false), Category("Design"), Description("Button Close")]
        public BarItemVisibility ButtonClose
        {
            get
            {
                return this.btnClose.Visibility;
            }
            set
            {
                this.btnClose.Visibility = value;
                base.Update();
            }
        }

        [DefaultValue(false), Category("Design"), Description("Button Delete")]
        public BarItemVisibility ButtonDelete
        {
            get
            {
                return this.btnDelete.Visibility;
            }
            set
            {
                this.btnDelete.Visibility = value;
                base.Update();
            }
        }

        [Category("Design"), Description("Button Edit"), DefaultValue(false)]
        public BarItemVisibility ButtonEdit
        {
            get
            {
                return this.btnEdit.Visibility;
            }
            set
            {
                this.btnEdit.Visibility = value;
                base.Update();
            }
        }

        [Category("Design"), DefaultValue(false), Description("Button Export")]
        public BarItemVisibility ButtonExport
        {
            get
            {
                return this.btnExport.Visibility;
            }
            set
            {
                this.btnExport.Visibility = value;
                base.Update();
            }
        }

        [Category("Design"), Description("Button Import"), DefaultValue(false)]
        public BarItemVisibility ButtonImport
        {
            get
            {
                return this.btnImport.Visibility;
            }
            set
            {
                this.btnImport.Visibility = value;
                base.Update();
            }
        }

        [Category("Design"), DefaultValue(false), Description("Button Info")]
        public BarItemVisibility ButtonInfo
        {
            get
            {
                return this.btnInfo.Visibility;
            }
            set
            {
                this.btnInfo.Visibility = value;
                base.Update();
            }
        }

        [Description("Button Print"), Category("Design"), DefaultValue(false)]
        public BarItemVisibility ButtonPrint
        {
            get
            {
                return this.btnPrint.Visibility;
            }
            set
            {
                this.btnPrint.Visibility = value;
                base.Update();
            }
        }

        [DefaultValue(false), Description("Button SaveAndAdd"), Category("Design")]
        public BarItemVisibility ButtonRefresh
        {
            get
            {
                return this.btnRefresh.Visibility;
            }
            set
            {
                this.btnRefresh.Visibility = value;
                base.Update();
            }
        }

        [Description("Button Change"), Category("Design"), DefaultValue(false)]
        public BarItemVisibility ButtonSave
        {
            get
            {
                return this.btnSave.Visibility;
            }
            set
            {
                this.btnSave.Visibility = value;
                base.Update();
            }
        }

        [DefaultValue(false), Category("Design"), Description("Button SaveAndAdd")]
        public BarItemVisibility ButtonSaveClose
        {
            get
            {
                return this.btnSaveAndClose.Visibility;
            }
            set
            {
                this.btnSaveAndClose.Visibility = value;
                base.Update();
            }
        }

        [DefaultValue(false), Description("Button SaveAndAdd"), Category("Design")]
        public BarItemVisibility ButtonSaveNew
        {
            get
            {
                return this.btnSaveAndAdd.Visibility;
            }
            set
            {
                this.btnSaveAndAdd.Visibility = value;
                base.Update();
            }
        }

        public bool EnableButtonAdd
        {
            set
            {
                this.btnAdd.Enabled = value;
                base.Update();
            }
        }

        public bool EnableButtonCancel
        {
            set
            {
                this.btnCancel.Enabled = value;
                base.Update();
            }
        }

        public bool EnableButtonDelete
        {
            set
            {
                this.btnDelete.Enabled = value;
                base.Update();
            }
        }

        public bool EnableButtonEdit
        {
            set
            {
                this.btnEdit.Enabled = value;
                base.Update();
            }
        }

        public bool EnableButtonSave
        {
            set
            {
                this.btnSave.Enabled = value;
                base.Update();
            }
        }

        public bool EnableButtonSaveAndAdd
        {
            set
            {
                this.btnSaveAndAdd.Enabled = value;
                base.Update();
            }
        }

        public bool EnableButtonSaveAndClose
        {
            set
            {
                this.btnSaveAndClose.Enabled = value;
                base.Update();
            }
        }

        public delegate void ClickButtonEventHander();
        public event ClickButtonEventHander AddClick;

        public event ClickButtonEventHander CancelClick;

        public event ClickButtonEventHander CloseClick;

        public event ClickButtonEventHander DeleteClick;

        public event ClickButtonEventHander EditClick;

        public event ClickButtonEventHander ExportClick;

        public event ClickButtonEventHander ImportClick;

        public event ClickButtonEventHander InfoClick;

        public event ClickButtonEventHander PrintClick;

        public event ClickButtonEventHander RefreshClick;

        public event ClickButtonEventHander SaveAndAddClick;

        public event ClickButtonEventHander SaveAndCloseClick;

        public event ClickButtonEventHander SaveClick;

        private void btnAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            this.InvokeAddClick();
            this.btnInfo.Visibility = BarItemVisibility.Always;
        }

        private void btnCancel_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeCancelClick();
        }

        private void btnClose_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeCloseClick();
        }

        private void btnDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeDeleteClick();
        }

        private void btnEdit_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeEditClick();
        }

        private void btnExport_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeExportClick();
        }

        private void btnImport_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeImportClick();
        }

        private void btnInfo_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeInfoClick();
        }

        private void btnPrint_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokePrintClick();
        }

        private void btnRefresh_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeRefreshClick();
        }

        private void btnSave_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeSaveClick();
        }

        private void btnSaveAndAdd_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeSaveAndAddClick();
        }

        private void btnSaveAndClose_ItemClick(object sender, ItemClickEventArgs e)
        {
            this.InvokeSaveAndCloseClick();
        }

    }
}
